<template>
  <div class="container">
    <div class="popup">
      <div class="books">
        <span class="names">热门新碟</span>
      </div>
      <ul class="lists">
        <li v-for="newAlbum in album" :key="newAlbum.id">
          <div class="items">
            <img class="picture" v-lazy="newAlbum.picUrl" alt="" />
            <a class="namespace" href="javascript:;" title="名字"></a>
            <a class="plays" href="javascript:;" title="播放"></a>
          </div>
          <p class="big-name">
            <a href="javascript:;">{{ newAlbum.name }}</a>
          </p>
          <p class="small-name">
            <a href="javascript:;">小名字</a>
          </p>
        </li>
      </ul>
      <div class="books">
        <span class="names">全部新碟</span>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: "newAlbum",
};
</script>

<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { getNewAlbumApi } from "@/api/discoverMusic/album";
import type { NewAlbumList } from "@/api/discoverMusic/model/albumModel";

const album = ref<NewAlbumList>();

const getNewAlbumList = async () => {
  const res = await getNewAlbumApi();
  console.log(res);
  album.value = res.albums.slice(0, 10);
  console.log(album.value);
};
onMounted(getNewAlbumList);
</script>

<style scoped>
.container {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
}
.container .popup {
  width: 980px;
  height: 100%px;
  margin: 0 auto;
  padding: 40px;
  background-color: #ffffff;
  border: 1px solid #d3d3d3;
}
.container .popup .books {
  width: 900px;
  height: 40px;
  border-bottom: 2px solid #c20c0c;
}
.container .popup .books .names {
  width: 96px;
  height: 32px;
  color: #333;
  font-size: 24px;
}
.container .popup .lists {
  width: 933px;
  height: 416px;
  margin: 20px 0 0 -33px;
  display: flex;
  flex-wrap: wrap;
}
.container .popup .lists li {
  flex: 20%;
  width: 153px;
  height: 178px;
  padding-left: 33px;
}
.container .popup .lists li .items .picture {
  width: 130px;
  height: 130px;
  /* position: relative; */
  /* border: 2px solid red; */
}
.container .popup .lists li .items .namespace {
  width: 153px;
  height: 130px;
  background-position: 0 -845px;
}
/* .container .popup .lists li .items .plays {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: #c20c0c;
} */
.container .popup .lists li p {
  width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.container .popup .lists li .big-name {
  margin: 8px 0 3px;
  font-size: 14px;
  color: #000;
}
.container .popup .lists li .small-name {
  color: #666;
  font-size: 12px;
}
</style>
